package com.sth.deadLock;

public class Lock1 implements Runnable {
    @Override
    public void run() {
        System.out.println("lock1  running");
        try {
            System.out.println("Lock1 running");
            synchronized (Lock1.class) {
                System.out.println("Lock1 lock obj1");
                Thread.sleep(3000);
                synchronized (Lock2.class) {
                    System.out.println("Lock2 lock obj2");
                }
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
